﻿namespace SERFLITEMAX20.WinUI.Controls
{
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;

    public class frmSelectType : Form
    {
        private Button btnCancel;
        private Button btnOk;
        private ComboBox cboType;
        private IContainer components = null;
        private Label label3;
        private string mSelectedType = null;

        public frmSelectType()
        {
            this.InitializeComponent();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            if (this.cboType.SelectedItem != null)
            {
                this.mSelectedType = ((DataRowView) this.cboType.SelectedItem)["Name"].ToString();
                base.Close();
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.cboType = new System.Windows.Forms.ComboBox();
            this.label3 = new System.Windows.Forms.Label();
            this.btnCancel = new System.Windows.Forms.Button();
            this.btnOk = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // cboType
            // 
            this.cboType.FormattingEnabled = true;
            this.cboType.Location = new System.Drawing.Point(48, 12);
            this.cboType.Name = "cboType";
            this.cboType.Size = new System.Drawing.Size(163, 21);
            this.cboType.TabIndex = 26;
            // 
            // label3
            // 
            this.label3.Location = new System.Drawing.Point(5, 15);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(37, 20);
            this.label3.TabIndex = 25;
            this.label3.Text = "Type";
            // 
            // btnCancel
            // 
            this.btnCancel.Location = new System.Drawing.Point(254, 36);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new System.Drawing.Size(85, 20);
            this.btnCancel.TabIndex = 28;
            this.btnCancel.Text = "Cancel";
            this.btnCancel.UseVisualStyleBackColor = true;
            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
            // 
            // btnOk
            // 
            this.btnOk.Location = new System.Drawing.Point(254, 10);
            this.btnOk.Name = "btnOk";
            this.btnOk.Size = new System.Drawing.Size(85, 20);
            this.btnOk.TabIndex = 27;
            this.btnOk.Text = "OK";
            this.btnOk.UseVisualStyleBackColor = true;
            this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
            // 
            // frmSelectType
            // 
            this.ClientSize = new System.Drawing.Size(389, 72);
            this.Controls.Add(this.btnCancel);
            this.Controls.Add(this.btnOk);
            this.Controls.Add(this.cboType);
            this.Controls.Add(this.label3);
            this.Name = "frmSelectType";
            this.Text = "frmSelectType";
            this.ResumeLayout(false);

        }

        private void UpdateViewer()
        {
            DataTable table = new DataTable();
            table.Columns.Add("Name");
            table.Columns.Add("Value");
            table.Rows.Add(new object[] { "Long", "1" });
            table.Rows.Add(new object[] { "Integer", "2" });
            table.Rows.Add(new object[] { "Float", "3" });
            table.Rows.Add(new object[] { "String", "4" });
            this.cboType.DisplayMember = "Name";
            this.cboType.ValueMember = "Value";
            this.cboType.DataSource = table;
        }

        public string View()
        {
            this.UpdateViewer();
            base.ShowDialog();
            return this.mSelectedType;
        }
    }
}

